<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo ($title); ?></title>
    <meta name="keywords" content="<?php echo ($title); ?>">
    <meta name="description" content="<?php echo ($title); ?>">
    <link href="/Public/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/static/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/Public/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/static/admin/css/animate.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/Public/static/admin/css/plugins/simditor/simditor.css" />

    <link rel="stylesheet" type="text/css" href="/Public/static/admin/css/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="/Public/static/admin/css/demo/webuploader-demo.css">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加商品</h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" id="form1" name="form1" class="form-horizontal" action="<?php echo U();?>" enctype="multipart/form-data">
                        <input id="litimg" name="litimg" type="hidden" value="">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品名称：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="goods_name" name="goods_name">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品品牌：</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="brand_id" id="brand_id">
                                    <option value="">===请选择品牌===</option>
                                    <?php if(is_array($brand_info)): foreach($brand_info as $k=>$v): ?><option value="<?php echo ($k); ?>"><?php echo ($v); ?></option><?php endforeach; endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品类别：</label>
                            <div class="col-sm-10">
                                <select class="form-control" name="classification_id" id="classification_id">
                                    <option value="">===请选择商品类别===</option>
                                    <?php if(is_array($classification_info)): $i = 0; $__LIST__ = $classification_info;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><option value="<?php echo ($v["id"]); ?>">
                                            <?php
 if($v['level']==1){ echo $v['classification']; }else{ echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; for($i = 1; $i < $v['level']; $i++){ echo '-----'; } echo $v['classification']; } ?>
                                        </option><?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">缩略图：</label>
                            <div class="col-sm-10">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-content">
                                        <div class="page-container">
                                            <div id="uploader" class="wu-example">
                                                <div class="queueList">
                                                    <div id="dndArea" class="placeholder">
                                                        <div id="filePicker"></div>
                                                        <p>或将照片拖到这里，单次最多可选300张</p>
                                                    </div>
                                                </div>
                                                <div class="statusBar" style="display:none;">
                                                    <div class="progress">
                                                        <span class="text">0%</span>
                                                        <span class="percentage"></span>
                                                    </div>
                                                    <div class="info"></div>
                                                    <div class="btns">
                                                        <div id="filePicker2"></div>
                                                        <div class="uploadBtn">开始上传</div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">简要描述：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="description" id="description">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">市场价：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="market_price" id="market_price">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">本店价：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="fd_price" id="fd_price">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">库存：</label>
                            <div class="col-sm-10">
                                <input type="number" class="form-control" name="number" id="number">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否是积分商品：</label>
                            <div class="col-sm-9">
                                <label class="radio-inline">
                                    <input type="radio" value="1" id="optionsRadios1" name="is_integral">是</label>
                                <label class="radio-inline">
                                    <input type="radio" checked value="0" id="optionsRadios2" name="is_integral">否</label>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">销售积分：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="integral" id="integral" disabled>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">返积分比例：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="ret_integral" id="ret_integral">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品详情：</label>
                            <div class="col-sm-10">
                                <div class="ibox float-e-margins">
                                    <div class="ibox-content">
                                        <textarea id="body" name="body" placeholder="这里输入内容" autofocus></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit"><i class="fa fa-cloud-upload"></i> 添 加</button>
                                <a class="btn btn-danger" href="javascript:history.go(-1)"><i class="fa fa-close"></i> 取 消</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/Public/static/admin/js/jquery.min.js"></script>
<script src="/Public/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Public/static/admin/js/jquery.form.js"></script>
<script src="/Public/static/admin/js/content.js?v=1.0.0"></script>
<script src="/Public/static/admin/js/plugins/switchery/switchery.js"></script>
<script src="/Public/static/admin/js/plugins/layer/layer.min.js"></script>
<script src="/Public/static/admin/js/common.js"></script>
<!-- simditor -->
<script type="text/javascript" src="/Public/static/admin/js/plugins/simditor/module.js"></script>
<script type="text/javascript" src="/Public/static/admin/js/plugins/simditor/uploader.js"></script>
<script type="text/javascript" src="/Public/static/admin/js/plugins/simditor/hotkeys.js"></script>
<script type="text/javascript" src="/Public/static/admin/js/plugins/simditor/simditor.js"></script>
<script>
    $(document).ready(function () {
        var editor = new Simditor({
            textarea: $('#body'),
            defaultImage: '/Upload/image/goods_img/20170227/58b37c601af48.jpg'
        });
    });
</script>
<!-- Web Uploader -->
<script type="text/javascript">
    // 添加全局站点信息
    var BASE_URL = './Public/static/admin/js/plugins/webuploader';
</script>
<script src="/Public/static/admin/js/plugins/webuploader/webuploader.min.js"></script>
<script src="/Public/static/admin/js/demo/webuploader-demo.js"></script>
<script>
    $(function(){
        $('#form1').ajaxForm({
            beforeSubmit: checkFun,
            success: complete,
            dataType: 'json'
        });
        function checkFun(){
            if($('#goods_name').val() == ''){
                sxshop.error('商品名称不能为空！');
                return false;
            }
            if($('#brand_id').val() == ''){
                sxshop.error('品牌不能为空！');
                return false;
            }
            if($('#classification_id').val() == ''){
                sxshop.error('商品类别不能为空！');
                return false;
            }
        }
        function complete(data){
            if(data.state > 0){
                sxshop.error(data.msg);
                return false;
            }else{
                sxshop.success(data.msg,'<?php echo U("index");?>')
            }
        }

        $('#optionsRadios1').on('click',function(){
            $('#integral').removeAttr('disabled');
            $('#market_price').attr('disabled','');
            $('#fd_price').attr('disabled','');
            $('#ret_integral').attr('disabled','');
        });
        $('#optionsRadios2').on('click',function(){
            $('#integral').attr('disabled','');
            $('#market_price').removeAttr('disabled');
            $('#fd_price').removeAttr('disabled');
            $('#ret_integral').removeAttr('disabled');
        });
    })
</script>
</body>
</html>